import Promise from 'bluebird';

/**
 * 异步启动服务, 并返回 Promise
 * @param {Server} server
 * @param {number} port
 * @return {Promise<Object, Error>}
 */
export async function listenAsync(server, port) {
    return Promise.fromCallback(callback => {
        return server.listen(port, callback);
    }).then(() => server);
}
